﻿CREATE PROCEDURE [dbo].[EditCargoRow]
(	@CargoID int,
	@CargoName varchar(100),
	@CargoDescription varchar(250),
	@CargoShortCode nchar(5),
	@CargoCode nchar(6),
	@CargoETSNGName varchar(250),
	@CargoCodeGNG nchar(8),
	@CargoGNGName varchar(250),
	@CargoMnemocode varchar(12),
	@cargoIsUsed bit,
	@CargoIsEmpty bit
)
AS
	Update CargoGNG
	Set Name = @CargoGNGName
	where CargoGNG_ID = @CargoCodeGNG;

	UPDATE CargoETSNG
	SET Name = @CargoETSNGName
	where CargoETSNG_ID = @CargoCode;

	UPDATE Cargo
	SET 
	Name = @CargoName, 
	Description = @CargoDescription, 
	ShortCode = @CargoShortCode,
	Code = @CargoCode,
	CodeGNG = @CargoCodeGNG,
	Mnemocode = @CargoMnemocode,
	IsUsed = @cargoIsUsed,
	IsEmpty = @CargoIsEmpty
WHERE Cargo.Cargo_ID = @CargoID ;

RETURN 0
